import { defineStore } from 'pinia'

interface UserInfo {
  id: number
  username: string
}

export const useUserStore = defineStore('user', {
  state: () => ({
    userInfo: null as UserInfo | null
  }),
  actions: {
    logout() {
      this.userInfo = null
    }
  }
})

// ✅ 关键：改成默认导出
export default useUserStore